//
//  SSSRecordOrderViewController.m
//  SSSMerchant
//
//  Created by 谢曦 on 2017/3/22.
//  Copyright © 2017年 xnxin. All rights reserved.
//

#import "SSSRecordOrderViewController.h"
#import "SSSRecordOrderCell.h"
#import "SSSRecordOrderToEditingViewController.h"
#import "SSSRecordOrderToPayViewController.h"
#import "SSSRecordOrderRecordViewController.h"
@interface SSSRecordOrderViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray *_dataArr;
}
//@property (nonatomic,strong) UITableView *tableView;
@end

@implementation SSSRecordOrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"我要录单";
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
   self.tableView.tableFooterView=[UIView new];
  
    [self.tableView registerNib:[UINib nibWithNibName:@"SSSRecordOrderCell" bundle:nil] forCellReuseIdentifier:@"SSSRecordOrderCell"];
    _dataArr=@[@[@"icon_home_01",@"待编辑"],@[@"icon_home_01",@"待支付"],@[@"icon_home_01",@"录单记录"]];
    [self tableView];
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SSSRecordOrderCell *cell=[tableView dequeueReusableCellWithIdentifier:@"SSSRecordOrderCell"forIndexPath:indexPath];
    cell.title=[_dataArr[indexPath.section] lastObject];
    cell.imageName=[_dataArr[indexPath.section] firstObject];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 75;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 15;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        SSSRecordOrderToEditingViewController *toEditVC=[[SSSRecordOrderToEditingViewController alloc] init];
        [self.navigationController pushViewController:toEditVC animated:YES];
    }
    if (indexPath.section==1) {
        SSSRecordOrderToPayViewController *toPayVC=[[SSSRecordOrderToPayViewController alloc] init];
        [self.navigationController pushViewController:toPayVC animated:YES];
    }
    if (indexPath.section==2) {
        SSSRecordOrderRecordViewController *orderVC=[[SSSRecordOrderRecordViewController alloc] init];
        [self.navigationController pushViewController:orderVC animated:YES];

    }

}

//-(UITableView *)tableView
//{
//    if (!_tableView) {
//        _tableView=[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
//        _tableView.backgroundColor=[UIColor colorWithHex:@"F6F6F6"];
//        
//        [self.view addSubview:_tableView];
//    }
//    
//    return _tableView;
//    
//}

@end
